<!DOCTYPE html>
<html lang="{{.Locale}}">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="refresh" content="3600">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="theme-color" content="#fff">
    <title>{{.TemplateTitle}}</title>
    <link rel="stylesheet" href="{{asset .Domain "/fonts/fonts.css" .ContextName}}">
    <link rel="stylesheet" href="{{asset .Domain "/css/cozy-bs.min.css" .ContextName}}">
    <link rel="stylesheet" href="{{asset .Domain "/styles/theme.css" .ContextName}}">
    <link rel="stylesheet" href="{{asset .Domain "/styles/cirrus.css" .ContextName}}">
    {{.Favicon}}
    <link rel="preload" href="/assets/icons/check.svg" as="image">
  </head>
  <body class="cirrus">
    <form id="two-factor-form" method="POST" action="/auth/twofactor" class="d-contents">
      <input id="state" type="hidden" name="state" value="{{.State}}" />
      <input id="client_id" type="hidden" name="client_id" value="{{.ClientID}}" />
      <input id="redirect" type="hidden" name="redirect" value="{{.Redirect}}" />
      <input id="confirm" type="hidden" name="redirect" value="{{.Confirm}}" />
      <input id="two-factor-token" type="hidden" name="two-factor-token" value="{{.TwoFactorToken}}" />
      <input id="long-run-session" name="long-run-session" type="hidden" value="{{.LongRunSession}}" />
      <main class="wrapper">

        <header class="wrapper-top d-flex flex-row align-items-center">
          <a href="/auth/login" class="btn btn-icon" aria-label="{{t "Back icon label"}}">
            <span class="icon icon-back"></span>
          </a>
          <div class="vertical-separator d-sm-none" role="separator"></div>
          <a href="https://cozy.io/" class="btn p-2 d-sm-none">
            		<img src="{{asset .Domain "/images/logo-dark.svg"}}" alt="Twake Workplace" class="logo" />
          </a>
        </header>

        <div class="d-flex flex-column align-items-center">
          <h1 class="h4 h2-md mb-3 text-center">{{t "Login Two factor title"}}</h1>
          <p class="mb-4 mb-md-5 text-center">{{t "Login Two factor help"}}</p>
          <div id="two-factor-field" class="form-floating has-validation w-100 mb-3">
            <input type="text" class="form-control form-control-md-lg" id="two-factor-passcode" name="two-factor-passcode" autofocus autocomplete="one-time-code" pattern="[0-9]*" inputmode="numeric" maxlength="6" />
            <label for="two-factor-passcode">{{t "Login Two factor field"}}</label>
            {{if .CredentialsError}}
            <div class="invalid-tooltip mb-1">
              <div class="tooltip-arrow"></div>
              <span class="icon icon-alert bg-danger"></span>
              {{.CredentialsError}}
            </div>
            {{end}}
          </div>
          {{if .TrustedDeviceCheckBox}}
          <div class="form-check align-self-start">
            <input class="form-check-input" type="checkbox" id="two-factor-trust-device" name="two-factor-trust-device" />
            <label class="form-check-label" for="two-factor-trust-device">
              {{t "Login Two factor device trust field"}}
            </label>
          </div>
          {{else}}
          <input id="two-factor-trust-device" class="two-factor-trust-device-checkbox" name="two-factor-trust-device" type="hidden"/>
          {{end}}
        </div>

        <footer class="w-100">
          <button id="two-factor-submit" class="btn btn-primary btn-md-lg w-100 my-3 mt-md-5" type="submit">
            {{t "Login Confirm"}}
          </button>
        </footer>

      </main>
    </form>
    <script src="{{asset .Domain "/scripts/cirrus.js"}}"></script>
    <script src="{{asset .Domain "/scripts/twofactor.js"}}"></script>
  </body>
</html>
